package conchmusic.conchmusicclient.mainUi;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Display;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;

import conchmusic.conchmusicclient.R;

/**
 * Created by arsenal_tj on 2017/4/19.
 */

public class SurePopup extends Dialog {

    Activity context;
    private Button sureDelete;
    public Button notSure;

    private View.OnClickListener mClickListener;

    public SurePopup(Activity context) {
        super(context);
        this.context = context;
    }

    public SurePopup(Activity context, int theme, View.OnClickListener clickListener) {
        super(context, theme);
        this.context = context;
        this.mClickListener = clickListener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.sure_popup);

        Window dialogWindow = this.getWindow();
        WindowManager m = context.getWindowManager();
        Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
        WindowManager.LayoutParams p = dialogWindow.getAttributes();
        p.height = (int) (d.getHeight() * 0.18); // 高度设置为屏幕的0.3
        p.width = (int) (d.getWidth() * 0.6); // 宽度设置为屏幕的0.8
        dialogWindow.setAttributes(p);
        sureDelete = (Button) findViewById(R.id.sureDelete);
        notSure = (Button) findViewById(R.id.notSureDelete);

        sureDelete.setOnClickListener(mClickListener);
        notSure.setOnClickListener(mClickListener);


        this.setCancelable(true);
    }
}
